Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Snap build/publish Github action #6805

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Nightmayr
Copy link

Github action to build the Clementine snap, as well as publishing it to the snap store. The job requires a few things before it will pass:

  • A snapcraft.io account and ownership of the clementine snap name (will need to be transferred from the current maintainer)
  • exporting the snapcraft.io login credentials to be used as a secret SNAP_STORE_LOGIN (documented on the publish action page https://github.com/snapcore/action-publish)

The job currently publishes to the edge channel.

Created this PR after seeing a Github action was a pre-requisite for adopting the snap in this issue: #6801

@kz6fittycent
Copy link
Contributor

This is great! Thanks for helping out - I think this will make more sense going forward.

@hatstand
Copy link
Contributor

hatstand commented Oct 1, 2020

Nice! Can you separate the build & the publish step and then only publish when the action is running for master? e.g. if: github.ref == 'refs/heads/master'

@Nightmayr
Copy link
Author

I've added the conditional check for the master branch, the job will now only publish if the action is running for master.
In terms of publishing I'm assuming stable releases such as 1.3.1 or 1.4.0 when it lands, will be manually promoted to the stable channel for the snap as they aren't released too often?

@kz6fittycent
Copy link
Contributor

Yeah I don't know of any way to automate publishing to stable. I don't even think it's a good idea until at least some sort of smoke test is performed.

@Nightmayr
Copy link
Author

Nightmayr commented Oct 4, 2020

Yep agreed, automated publishing to edge makes sense

@hatstand
Copy link
Contributor

hatstand commented Oct 5, 2020

What do I need to do here with regards to creating snap accounts, channels, etc?

@kz6fittycent
Copy link
Contributor

What do I need to do here with regards to creating snap accounts, channels, etc?

Head over to the snapcraft forum and create an account. Start a post with something like "Transfer ownership of Clementine snap". It'll need to get tagged with "Store".

Explain who you are and that you'd like to transfer the snap to your project. Tag me @kz6fittycent and I'll make sure to dovetail whatever you state.

Once that happens, your same creds are used to log into the build service, etc. This will let you edit the posting, etc. You can then manage releases in your dashboard (e.g. moving edge builds to stable, etc). Any time you make a commit to the branch the snap is tied to, it'll automatically build and release to the edge channel.

The whole thing should take no more than 30 min.

As for Canonical transferring the snap, it might take some time. Last time I did this, it took make 3 days for them to complete it. That was for the slcli snap that SoftLayer now owns.

Feel free to hit me up with any questions you may have. I'm sure that @Nightmayr may have additional input besides what I've written.

@hatstand
Copy link
Contributor

hatstand commented Oct 5, 2020

It looks like the snap version needs updated in the yml to match the other builds.

@kz6fittycent
Copy link
Contributor

It looks like the snap version needs updated in the yml to match the other builds.

That can be handled with adopt-info and it'll be automatically matched to the github release. I can add that back to it but it broke last release.

@Nightmayr
Copy link
Author

What do I need to do here with regards to creating snap accounts, channels, etc?

Head over to the snapcraft forum and create an account. Start a post with something like "Transfer ownership of Clementine snap". It'll need to get tagged with "Store".

Explain who you are and that you'd like to transfer the snap to your project. Tag me @kz6fittycent and I'll make sure to dovetail whatever you state.

Once that happens, your same creds are used to log into the build service, etc. This will let you edit the posting, etc. You can then manage releases in your dashboard (e.g. moving edge builds to stable, etc). Any time you make a commit to the branch the snap is tied to, it'll automatically build and release to the edge channel.

The whole thing should take no more than 30 min.

As for Canonical transferring the snap, it might take some time. Last time I did this, it took make 3 days for them to complete it. That was for the slcli snap that SoftLayer now owns.

Feel free to hit me up with any questions you may have. I'm sure that @Nightmayr may have additional input besides what I've written.

Think you've covered everything, I'll just state the obvious that the account being created rather than being a personal account should be an account to represent the Clementine project. I've seen a few transfer of ownership requests on the forum and they're normally followed up by a request to add the created account as a collaborator to ease the transfer.

@kz6fittycent
Copy link
Contributor

It looks like the snap version needs updated in the yml to match the other builds.

That can be handled with adopt-info and it'll be automatically matched to the github release. I can add that back to it but it broke last release.

This is now fixed and the latest snap released to edge is 1.4.0rc1

@Nightmayr
Copy link
Author

With the versioning do we want to cut the version at 1.4.0rc1 or would it be preferable to show the entire version 1.4.0rc1-345-g9e8d4434a for better traceability?

@kz6fittycent
Copy link
Contributor

kz6fittycent commented Oct 5, 2020

With the versioning do we want to cut the version at 1.4.0rc1 or would it be preferable to show the entire version 1.4.0rc1-345-g9e8d4434a for better traceability?

That particular "length" of the version will break (and has broken) in the build/release stage and it won't release. It doesn't meet the required schema.

@Nightmayr
Copy link
Author

Ah ok would cut -d "-" -f1-2 work to provide the version 1.4.0rc1-345? Wondering if that would count as a valid version?

@kz6fittycent
Copy link
Contributor

Let me try it when I get a chance

@kz6fittycent
Copy link
Contributor

Yeah that worked - latest version in edge is 1.4.0rc1-345

@kz6fittycent
Copy link
Contributor

@hatstand I think everything is in place. Whenever you want to create that account on forum.snapcraft.io we can begin the transition.

@hatstand
Copy link
Contributor

hatstand commented Oct 6, 2020

Does that change not need to be made in the yml somewhere?

@kz6fittycent
Copy link
Contributor

I've made the change in my snapcraft.yaml and rebuilt the snap. As far as "the yaml", that can be added in yours pretty easily. Whereas we're comparing against @Nightmayr 's branch - that change may need to occur there before accepting the PR. See below for the current successful configuration for the snap.

name: clementine
#version: 'latest'
adopt-info: clementine
summary: modern music player
description: |
  Clementine is a modern music player and library organizer
grade: stable
confinement: strict
base: core18

architectures:
  - build-on: amd64
  - build-on: i386
  - build-on: arm64

parts:

  desktop-qt5:
    build-packages:
      - build-essential
      - qtbase5-dev
      - dpkg-dev
    make-parameters:
      - FLAVOR=qt5
    plugin: make
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: qt
    stage-packages:
      - libqt5gui5
      - libqt5svg5
      - libgdk-pixbuf2.0-0
      - locales-all
      - xdg-user-dirs
      - fcitx-frontend-qt5
      - libxkbcommon0
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - gnome-themes-standard
      - shared-mime-info
      - adwaita-icon-theme
      - oxygen-icon-theme
      - breeze-icon-theme
      - try: [appmenu-qt5]

  alsa-lib:
    plugin: autotools
    source: https://www.alsa-project.org/files/pub/lib/alsa-lib-1.1.5.tar.bz2
    configflags:
      - --prefix=/usr
      - --sysconfdir=/etc
      - --libexec=/usr/lib
      - --libdir=/usr/lib
      - --localstatedir=/var
      - --with-configdir=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/share/alsa
      - --with-plugindir=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/alsa-lib
      - --disable-static
    stage:
      - usr/include
      - usr/lib
    prime:
      - -usr/bin
      - -usr/include
      - -usr/lib/pkgconfig
      - -usr/share/alsa/alsa.conf
      - -usr/share/alsa/pcm
      - -usr/share/alsa/topology/broadwell

  clementine:
    plugin: cmake
    source-type: git
    source: https://github.com/clementine-player/Clementine
    after:
      - alsa-lib
      - desktop-qt5
      
    override-pull: |
      snapcraftctl pull
      snapcraftctl set-version "$(git describe --tags | sed 's/^v//' | cut -d "-" -f1-2)"
      
    override-build: |
      cmake ../src -DCMAKE_INSTALL_PREFIX=/usr
      make -j $(getconf _NPROCESSORS_ONLN)
      make DESTDIR=$SNAPCRAFT_PART_INSTALL install
      sed -i 's|Icon=clementine|Icon=/usr/share/icons/hicolor/scalable/apps/clementine\.svg|' $SNAPCRAFT_PART_INSTALL/usr/share/applications/clementine.desktop
      sed -i 's|TryExec=.*|TryExec=/snap/bin/clementine|' $SNAPCRAFT_PART_INSTALL/usr/share/applications/clementine.desktop
#      add-apt-repository ppa:rock-core/qt4 # may need this

    build-packages:
      - cmake
      - make
      - gcc
      - g++
      - protobuf-compiler
      - gettext
      - libglib2.0-dev
      - libgnutls28-dev
      - libdbus-1-dev
      - libprotobuf-dev
      - libboost-dev
      - libsqlite3-dev
      - libasound2-dev
      - libpulse-dev
      - libtag1-dev
      - qtbase5-dev
      - qtbase5-dev-tools
      - qtbase5-private-dev
      - qttools5-dev
      - libqt5x11extras5-dev
      - libqt5opengl5-dev
      - libgstreamer1.0-dev
      - libgstreamer-plugins-base1.0-dev
      - libcdio-dev
      - libgpod-dev
      - libmtp-dev
      - libplist-dev
      - libusbmuxd-dev
      - libchromaprint-dev
      - libfftw3-dev
      - liblastfm5-dev
      - libglew-dev
      - libcrypto++-dev
      - libsparsehash-dev
#      - libqt5-sqlite

    stage-packages:
      - libstdc++6
      - libgcc1
      - libprotobuf10
      - libpcre16-3
      - libqt5core5a
      - libqt5gui5
      - libqt5widgets5
      - libqt5concurrent5
      - libqt5network5
      - libqt5dbus5
      - libqt5sql5
      - libqt5x11extras5
      - libqt5opengl5
      - libqt5xml5
      - libqt5sql5-sqlite
      - libsqlite3-0
      - libgpm2
      - libasound2
      - libasound2-plugins
      - libpulse0
      - libcdio17
      - libgpod4
      - libmtp9
      - libplist3
      - libusbmuxd4
      - libtag1v5
      - libchromaprint1
      - zlib1g
      - libx11-6
      - libxcomposite1
      - libxcursor1
      - libxinerama1
      - libxrandr2
      - libdb5.3
      - libglu1
      - libslang2
      - libatk1.0-0
      - libatk-bridge2.0-0
      - libatk1.0-data
      - libatk-adaptor
      - libprojectm2v5
      - libcrypto++6
      - liblastfm5-1
      - libgstreamer1.0-0
      - libgstreamer-plugins-base1.0-0
      - gstreamer1.0-alsa
      - gstreamer1.0-pulseaudio
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-bad
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-libav
      - dbus-x11
      - projectm-data
      - qtwayland5 # Attempt at Wayland Support
      - libqtcore4 # Attempt to get Spotify to work
      - glibc-source # Attempt to get Spotify to work
      - plasma-integration
      - kde-style-breeze
      - qt5-gtk-platformtheme

plugs:
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes

apps:
  clementine:
    command: bin/desktop-launch $SNAP/usr/bin/clementine
    desktop: usr/share/applications/clementine.desktop
    environment:
      ALSA_CONFIG_PATH: /snap/$SNAPCRAFT_PROJECT_NAME/current/usr/share/alsa/alsa.conf
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
      DISABLE_WAYLAND: 1
    plugs:
      - home
      - udisks2
      - network
      - network-manager-observe
      - network-bind
      - desktop
      - desktop-legacy
      - x11
      - wayland
      - alsa
      - pulseaudio
      - removable-media
      - optical-drive
      - raw-usb
      - media-hub
      - screen-inhibit-control
      - unity7
    slots:
      - mpris

  clementine-tagreader:
    command: usr/bin/clementine-tagreader
    plugs:
      - network
      - network-manager-observe
      - network-bind

@hatstand
Copy link
Contributor

hatstand commented Oct 6, 2020

That needs to be part of this PR then.

@Nightmayr
Copy link
Author

Updated snapcraft.yaml added.

override-build: |
cmake ../src -DCMAKE_INSTALL_PREFIX=/usr
make -j $(getconf _NPROCESSORS_ONLN)
make DESTDIR=$SNAPCRAFT_PART_INSTALL install
sed -i 's|Icon=clementine|Icon=/usr/share/icons/hicolor/scalable/apps/clementine\.svg|' $SNAPCRAFT_PART_INSTALL/usr/share/applications/clementine.desktop
sed -i 's|TryExec=.*|TryExec=/snap/bin/clementine|' $SNAPCRAFT_PART_INSTALL/usr/share/applications/clementine.desktop
# add-apt-repository ppa:rock-core/qt4 # may need this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these commented out bits?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's removed now.

@@ -166,14 +179,35 @@ parts:
- gstreamer1.0-libav
- dbus-x11
- projectm-data
- qtwayland5 # Attempt at Wayland Support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these attempts work? If not, let's remove them. I very much doubt the Spotify one works but I don't know much about Wayland.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest version released shows logs that it's looking for a "libspotify". As I don't have a paid account, I have no way of validating whether it works. That said, the previous errors are gone. See: kz6fittycent/clementine#10

Copy link
Author

@Nightmayr Nightmayr Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Wayland attempt definitely works (I'll remove the comment)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kz6fittycent The libspotify.so is there, but there are broken symlinks. I have documented my findings in kz6fittycent/clementine#10

desktop: usr/share/applications/clementine.desktop
environment:
ALSA_CONFIG_PATH: /snap/$SNAPCRAFT_PROJECT_NAME/current/usr/share/alsa/alsa.conf
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
DISABLE_WAYLAND: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems counter to the attempt at wayland support above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to stay.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is needed for clementine to run as an XWayland app when in a wayland session. Without this environment variable, clementine looks like this in Wayland:
Screenshot from 2020-10-06 19-42-12
With the environment variable set in Wayland (running on XWayland) :
Screenshot from 2020-10-06 19-44-48
As you can see the XWayland app keeps the GTK theming and cursor theme.

@kz6fittycent
Copy link
Contributor

Checking in - are we ready to begin the transfer and accept the PR?

@Nightmayr
Copy link
Author

I managed to get the Spotify plugin to "work". I'm able to login using my Spotify premium account but I'm unable to search Spotify. The reason for this appears to be that libspotify is deprecated in favour of Spotify's own API's. I think Clementine itself will need to use an alternative library such as librespot to get Spotify working again. I can add the changes to get the Spotify plugin to function but it seems pointless to me.

@kz6fittycent
Copy link
Contributor

@hatstand checking in on where we're at with the inclusion of the snap and taking ownership. Any updates?

@kz6fittycent
Copy link
Contributor

I managed to get the Spotify plugin to "work". I'm able to login using my Spotify premium account but I'm unable to search Spotify. The reason for this appears to be that libspotify is deprecated in favour of Spotify's own API's. I think Clementine itself will need to use an alternative library such as librespot to get Spotify working again. I can add the changes to get the Spotify plugin to function but it seems pointless to me.

@theCalcaholic See here - seems to be related to the deprecated lib.

@fitojb
Copy link
Contributor

fitojb commented Mar 23, 2021

Any progress?

@kz6fittycent
Copy link
Contributor

kz6fittycent commented Apr 5, 2021

Any progress?

No news to report. @hatstand or @Nightmayr , anything to report? It's been a few months since our last discussion about transferring the snap to the Clementine project.

If I don't hear anything, I'll be taking the snap out of the store. Another party can takeover maintaining it.

@Nightmayr
Copy link
Author

I don't think there's anything further required on my end in terms of the snap, I believe it functions as expected on GNOME and KDE desktop environments. I believe the review comments have been addressed but if there's anything further required to get this PR merged I'd be interested to know. There's probably some additional refining that could be done but as it stands currently this PR should result in a functional snap being built and deployed to the edge channel

@kz6fittycent
Copy link
Contributor

kz6fittycent commented Aug 9, 2021

I'm currently experiencing failed builds in the snap. See this issue.

Additionally, I am no longer going to work on the Clementine snap. I will no longer be maintaining the repo nor trouble-shooting issues with it. I have a bit much on my plate at present and it's just not feasible for me to continue.

I have asked @Nightmayr to take over maintaining the snap, if desired.

That said, the most ideal situation is to have the Clementine project take full ownership and maintenance.

@kz6fittycent
Copy link
Contributor

kz6fittycent commented Aug 12, 2021

Builds are successful again. See previous comment(s) about maintaining the snap. Thanks for the assist @Nightmayr

@Zolokinos
Copy link

Are you here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants